let vm = new Vue({
    data: {
        list: [{
            id: 1,
            count: 2,
            price: 12.5
        }, {
            id: 2,
            count: 0,
            price: 10.5
        }, {
            id: 3,
            count: 3,
            price: 8.5
        }, {
            id: 4,
            count: 0,
            price: 8
        }, {
            id: 5,
            count: 0,
            price: 14.5
        }]
    },
    computed: {
        sub() {
            let counts = 0,
                prices = 0,
                max = [0];
            this.list.forEach(({ count, price }) => {
                counts += count;
                prices += count * price;
                if (count > 0) max.push(price);
            });
            return {
                counts,
                prices,
                max: Math.max(...max)
            };
        }
    },
    methods: {
        change(index, type) {
            let item = this.list[index];
            if (type === 'minus') {
                item.count--;
                if (item.count < 0) item.count = 0;
                return;
            }
            item.count++;
        }
    }
});
vm.$mount('#computedBox');